<template>
  <GFlowDesc>
    <GFlowDescItem label="模型名称：" :value="modelInfo?.sourceModelName" />
    <GFlowDescItem label="编码：" :value="modelInfo?.code" :span="16" />
    <GFlowDescItem
      label="核算模型数量："
      :value="modelInfo?.num && modelInfo?.num + modelInfo?.unit"
    />
    <GFlowDescItem label="数据采集周期：" :value="(modelInfo?.baseYear || '-') + '年'" />
    <GFlowDescItem label="请求编号：" :value="requestNo" />
  </GFlowDesc>
  <el-divider style="margin: 12px 0 8px; border-color: #ebeef5" />
</template>
<script lang="ts" setup name="AccountingBaseInfo">
import { ref, defineProps, defineEmits } from 'vue';
import { GFlowDesc, GFlowDescItem } from '@/components/GFlowDesc';
import { getRequestInfo } from '@/apis/todo/flowBusiness';
import type { GetRequestInfoResult } from '@/apis/todo/model/flowBusinessModel';
import { ProcessStatusEnums } from '@/constants/enum';

interface AccountingBaseInfoProps {
  requestNo: string;
}
const props = defineProps<AccountingBaseInfoProps>();
const emits = defineEmits(['loaded']);
const modelInfo = ref<GetRequestInfoResult>();
const auditInfo = ref({} as any);
async function getData() {
  try {
    modelInfo.value = await getRequestInfo(props.requestNo);
    auditInfo.value.status =
      modelInfo.value?.auditResult == 'NO' ? ProcessStatusEnums.REJECT : ProcessStatusEnums.REJECT;
    auditInfo.value.approval = modelInfo.value?.auditOpinion;
    emits('loaded', modelInfo.value);
    console.log('modelInfo.value', modelInfo.value);
  } catch (error) {
    console.log('error', error);
  }
}

getData();
</script>
